package com.swingson.other;

import java.awt.Component;
import java.util.ArrayList;
import java.util.List;

/**
 * @author Dmitry
 */
public class SwingularComponentWrapper {
    private final Component component;
    private final List<String> inputs = new ArrayList<>();
    private final List<ConditionAndAction> compiledExpressionList = new ArrayList<>();

    public SwingularComponentWrapper(Component component, ConditionAndAction compiledExpression) {
        this.component = component;
        this.compiledExpressionList.add(compiledExpression);
    }

    public List<ConditionAndAction> getCompiledExpressionList() {
        return compiledExpressionList;
    }

    public SwingularComponentWrapper addInput(String value) {
        if (!inputs.contains(value)) {
            inputs.add(value);
        }

        return this;
    }

    public SwingularComponentWrapper addInput(List<String> values) {
        for (String var : values) {
            inputs.add(var);
        }
        return this;
    }

    public Component getComponent() {
        return component;
    }

    public List<String> getInputs() {
        return inputs;
    }

}
